const Open_ID = uni.getStorageSync('openid')
const share  = uni.getStorageSync('ShareUrl')
import {setMemberShareAdd} from '@/api/global.js'
import {NowTime} from '@/static/js/DateUtil.js'
export default {
	data() {
		return {
			// 默认的全局分享内容
			share: {
				title: '海伦市世纪华联超市',
				path: '/pages/index/index?ShareOpenid='+Open_ID,
				imageUrl: 'https://digital.essc.top/dist/img1/0f67e08920240118094622.jpg'
			},
		}
	},
	async onShareAppMessage(res) {
		if(res.from=="button"){
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			let curRoute = routes[routes.length - 1].$page.fullPath
			
			uni.showLoading({title: "加载中..."});
			const res = await setMemberShareAdd({
				Open_ID,
				Data:JSON.stringify({
					Member_Share_SerialNumber:'',
					Share_Open_ID:Open_ID,
					Path:curRoute,
					Share_Date:NowTime(),
					App_ID:'wx752cd7c5466abbaf',
					Enterprise_Info_SerialNumber:'E00000000000016'
				})
			})
			uni.hideLoading();
			this.share.path = curRoute + '&ShareOpenid='+Open_ID+'&Member_Share_SerialNumber='+res.Data
			console.log(this.share.path);
		}
		return this.share
	},
	onShareTimeline(res) {
		if(res.from=="button"){
			
		}
		return this.share
	}
}